﻿using System;
using System.Windows;

namespace MagicControls
{
    public class IncorrectParentException : Exception
    {
        private const string messageTemplate = "Expected parent for {0} is {1}, but found {2}";

        public IncorrectParentException(FrameworkElement control, FrameworkElement parent, Type expectedParentType)
            : base(
                string.Format(messageTemplate, control != null ? control.GetType().ToString() : "null",
                              expectedParentType, parent != null ? parent.GetType().ToString() : "null"))
        {
        }
    }
}